package com.yz.newspaper.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.IPage;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yz.newspaper.pojo.po.UserScore;
import com.yz.newspaper.mapper.UserScoreMapper;
import com.yz.newspaper.pojo.unitPo.PageBean;
import com.yz.newspaper.service.IUserScoreService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * VIEW 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-05-02
 */
@Service
public class UserScoreServiceImpl extends ServiceImpl<UserScoreMapper, UserScore> implements IUserScoreService {

    @Override
    public PageBean getUserScore(String username, String mediaName, Integer year, Integer month, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<UserScore> list = baseMapper.getUserScore(username, mediaName, year, month);
        PageInfo<UserScore> pageInfo = new PageInfo<>(list);
        return new PageBean(pageInfo.getList(), pageInfo.getTotal());
    }
}
